Fourier series coefficient calculation